﻿using System.Collections.ObjectModel;

namespace BookSourceVerification.common;

public class ConsoleLogList<T>: ObservableCollection<T>
{
    private long cap = 1000;

    public ConsoleLogList()
    {
    }

    public ConsoleLogList(long cap)
    {
        this.cap = cap;
    }

    protected override void InsertItem(int index, T item)
    {
        if (index >= cap)
        {
            base.RemoveAt(0);
            index -= 1;
        }
        base.InsertItem(index, item);
    }
}